package com.xiaocq.wordskiller.db;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

import com.xiaocq.wordskiller.db.VocabularyDatabase.VocabularyMeta;

public class DatabaseHelper extends SQLiteOpenHelper {
	public static final String DATABASE_NAME = "words.db";
	public static final int DATABASE_VERSION = 1;

	public DatabaseHelper(Context context) {
		super(context, DATABASE_NAME, null, DATABASE_VERSION);
	}

	@Override
	public void onCreate(SQLiteDatabase db) {
		String createVocabulary = "CREATE TABLE " + VocabularyMeta.TABLE_NAME
				+ " (" + VocabularyMeta._ID + " INTEGER PRIMARY KEY,"
				+ VocabularyMeta.VOCABULARY + " TEXT," + VocabularyMeta.EXPLAIN
				+ " TEXT," + VocabularyMeta.TEST_COUNT + " INTEGER,"
				+ VocabularyMeta.CORRECT_COUNT + " INTEGER,"
				+ VocabularyMeta.ANSWER_STATE + " INTEGER,"
				+ VocabularyMeta.BELONG_TO + " INTEGER,"
				+ VocabularyMeta.LEAST_ACCESS + " INTEGER);";
		System.out.println(createVocabulary);

		db.execSQL(createVocabulary);
	}

	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
		// do some stuff.
	}

}
